//
//  HYAlertActionView.m
//  XPlayer
//
//  Created by liguoqing on 2023/10/10.
//

#import "HYAlertActionView.h"

@implementation HYAlertActionView

+ (void)showViewControler:(UIViewController *)viewController
                    title:(NSString *)title 
                  message:(NSString *)message 
              actionTitle:(NSArray *)actionTitle
                sureBlock:(dispatch_block_t)sureBlock
              cancelBlock:(dispatch_block_t)cancelBlock
{
    UIAlertController *alert = [UIAlertController alertControllerWithTitle:title message:message preferredStyle:UIAlertControllerStyleAlert];
    UIAlertAction *sureAction = [UIAlertAction actionWithTitle:actionTitle.firstObject style:UIAlertActionStyleDefault handler:^(UIAlertAction * _Nonnull action) {
        if(sureBlock){
            sureBlock();
        }
    }];
    UIAlertAction *cancleAction = [UIAlertAction actionWithTitle:actionTitle.lastObject style:UIAlertActionStyleCancel handler:^(UIAlertAction * _Nonnull action) {
        if(cancelBlock){
            cancelBlock();
        }
    }];
    [alert addAction:sureAction];
    [alert addAction:cancleAction];
    [viewController presentViewController:alert animated:YES completion:nil];
}

@end
